package org.jeecg.modules.wlhy.hyconfig.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.constant.CacheConstant;
import org.jeecg.modules.wlhy.hyconfig.entity.HyConfig;
import org.jeecg.modules.wlhy.hyconfig.mapper.HyConfigMapper;
import org.jeecg.modules.wlhy.hyconfig.service.IHyConfigService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.io.Serializable;

/**
 * @Description: hy_config
 * @Author: jeecg-boot
 * @Date:   2021-08-20
 * @Version: V1.0
 */
@Service
public class HyConfigServiceImpl extends ServiceImpl<HyConfigMapper, HyConfig> implements IHyConfigService {
    @Override
    @CacheEvict(cacheNames= CacheConstant.CACHE_HY_CONFIG, key="#entity.id")
    public boolean updateById(HyConfig entity) {
        return baseMapper.updateById(entity)==1;
    }

    @Override
    @Cacheable(unless="#result == null", cacheNames= CacheConstant.CACHE_HY_CONFIG, key="#id")
    public HyConfig getById(Serializable id) {
        return baseMapper.selectById(id);
    }

}
